package com.speedy.course.paging

import androidx.paging.PagingSource
import androidx.paging.PagingState
import com.speedy.course.db.AppDatabase
import com.speedy.course.db.entity.Task

class TaskPagingSource: PagingSource<Int, Task>() {

    override fun getRefreshKey(state: PagingState<Int, Task>): Int? {
        return null
    }

    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, Task> {
        return AppDatabase.getInstance().getTaskDao().queryTasks().load(params)
    }
}